/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package servlet;

import DAOClass.Members;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Phong
 */
public class update extends HttpServlet {

    Members objMember = new Members();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
       doPost(request, response);
    } 

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        PrintWriter out = response.getWriter();

        String user = request.getParameter("userName");
        String pass = request.getParameter("pass");
        String name = request.getParameter("name");
        int sex = Integer.parseInt(request.getParameter("sex"));
        String add = request.getParameter("add");
        String tel = request.getParameter("tel");
        String email = request.getParameter("mail");
        String birthday = request.getParameter("birthday");
        int status = Integer.parseInt(request.getParameter("status"));
        int group = Integer.parseInt(request.getParameter("idg"));

        objMember.editMember(user, group, pass, name, sex, birthday, tel, add, email, status);
        response.sendRedirect("Admin/members.jsp");
        /* {
        //out.println("update sucessfull");
        
        }
        else {*/
            out.println(user+"<br>");
            out.println(group+"<br>");
            out.println(pass+"<br>");
            out.println(name+"<br>");
            
            out.println(sex+"<br>");
            out.println(birthday+"<br>");
            out.println(tel+"<br>");
            out.println(add+"<br>");
            out.println(email+"<br>");
            out.println(status);
        //}
    }


    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>

}
